package com.zit.java.test;

import org.apache.poi.hpsf.Array;

import java.util.ArrayList;
import java.util.Arrays;

public class DubboSort {
    public static void main(String [] agrs){
    int [] bb = {1,12,5,6,5,7,6,1};
        int[] ints = sortMethod(bb);
        String s = Arrays.toString(ints);
        System.out.println(s);
    }

    public static int[] sortMethod(int [] arr){
        int temp;
        boolean flag = false;
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0 ; j<arr.length-1-i;j++){
                if (arr[j+1]<arr[j]){
                    temp = arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1] = temp;
                    flag = true;
                }
            }
            if (flag == false){
                break;
            }
        }
        return arr;
    }
}
